﻿using System;
using System.Collections.Generic;
using System.Text;

namespace Database.Classes
{
    public class ArtifactsFunctions
    {
        public static readonly List<string> ArtifactsList = new List<string>() { "AL", "GL", "AML", 
            "CS", "RF", "NF",
            "GT", "ITV",
            "E1", "E2", "E3",
            "PG", "GG",
            "ES", "PS",
            "STR", "BHS", "AF", "MOT"
        };

        public static bool Prerequisites(int UserId, string id)
        {
            switch (id)
            {//science artifacts
                case "AL":
                    if (UserDefinedFunctions.GetPlayerSciencePerH(UserId).Value >= 50)
                        return true;
                    else
                        return false;
                case "GL":
                    if (UserDefinedFunctions.GetPlayerSciencePerH(UserId).Value >= 150)
                        return true;
                    else
                        return false;
                case "AML":
                    if (UserDefinedFunctions.GetPlayerSciencePerH(UserId).Value >= 400)
                        return true;
                    else
                        return false;
                //production artifacts
                case "CS":
                    if (UserDefinedFunctions.GetPlayerProductionPerH(UserId).Value >= 50)
                        return true;
                    else
                        return false;
                case "RF":
                    if (UserDefinedFunctions.GetPlayerProductionPerH(UserId).Value >= 150)
                        return true;
                    else
                        return false;
                case "NF":
                    if (UserDefinedFunctions.GetPlayerProductionPerH(UserId).Value >= 300)
                        return true;
                    else
                        return false;
                //culture
                case "GT":
                    if (UserDefinedFunctions.GetPlayerCulturePerH(UserId).Value >= 50)
                        return true;
                    else
                        return false;
                case "ITV": if (UserDefinedFunctions.GetPlayerCulturePerH(UserId).Value >= 200)
                        return true;
                    else
                        return false;
                //growth
                case "E1":
                    if (UserDefinedFunctions.GetPlayerFloat(UserId, "Social").ToSqlInt32().Value >= 2)
                        return true;
                    else
                        return false;
                case "E2": if (UserDefinedFunctions.GetPlayerFloat(UserId, "Social").ToSqlInt32().Value >= 8)
                        return true;
                    else
                        return false;
                case "E3": if (UserDefinedFunctions.GetPlayerFloat(UserId, "Social").ToSqlInt32().Value >= 15)
                        return true;
                    else
                        return false;
                //attack
                case "PG":
                    if (Equations.PlayerLevel(UserDefinedFunctions.GetPlayerInt(UserId, "ExpPoints").Value) >= 10)
                        return true;
                    else
                        return false;
                case "GG":
                    if (Equations.PlayerLevel(UserDefinedFunctions.GetPlayerInt(UserId, "ExpPoints").Value) >= 30)
                        return true;
                    else
                        return false;
                //defense
                case "ES": if (Equations.PlayerLevel(UserDefinedFunctions.GetPlayerInt(UserId, "ExpPoints").Value) >= 12)
                        return true;
                    else
                        return false;
                case "PS": if (Equations.PlayerLevel(UserDefinedFunctions.GetPlayerInt(UserId, "ExpPoints").Value) >= 32)
                        return true;
                    else
                        return false;

                //special artifacts
                case "STr":
                    if (Equations.PlayerLevel(UserDefinedFunctions.GetPlayerInt(UserId, "ExpPoints").Value) >= 12 &&
                        UserDefinedFunctions.PlayerHasSpecialBulding(UserId, SpecialBuldings.OrbitalCC) == true &&
                        UserDefinedFunctions.PlayerHasSpecialBulding(UserId, SpecialBuldings.Market) == true)
                        return true;
                    else
                        return false;
                case "BHS": if (Equations.PlayerLevel(UserDefinedFunctions.GetPlayerInt(UserId, "ExpPoints").Value) >= 20)
                        return true;
                    else
                        return false;
                case "AF": if (Equations.PlayerLevel(UserDefinedFunctions.GetPlayerInt(UserId, "ExpPoints").Value) >= 30)
                        return true;
                    else
                        return false;
                case "MOT": if (UserDefinedFunctions.GetPlayerCulturePerH(UserId).Value >= 200 &&
                    UserDefinedFunctions.GetPlayerSciencePerH(UserId).Value >= 400 &&
                    UserDefinedFunctions.PlayerHasSpecialBulding(UserId, SpecialBuldings.Market) == true)
                        return true;
                    else
                        return false;
                default:
                    return false;
            }
        }
        public static string ArtifactDescription(string id)
        {
            switch (id)
            {//science artifacts
                case "AL": return "This artifact gives you 10% to science";
                case "GL": return "This artifact gives you 20% to science";
                case "AML": return "This artifact gives you 30% to science";
                //production artifacts
                case "CS": return "This artifact gives you 10% to production";
                case "RF": return "This artifact gives you 20% to production";
                case "NF": return "This artifact gives you 30% to production";
                //culture
                case "GT": return "This artifact gives you 10% to culture";
                case "ITV": return "This artifact gives you 20% to culture";
                //growth
                case "E1": return "This artifact gives you 10% to growth";
                case "E2": return "This artifact gives you 20% to growth";
                case "E3": return "This artifact gives you 30% to growth";
                //attack
                case "PG": return "This artifact gives you 7% to attack";
                case "GG": return "This artifact gives you 14% to attack";
                //defense
                case "ES": return "This artifact gives you 8% to defense";
                case "PS": return "This artifact gives you 16% to defense";

                //special artifacts
                case "STr": return "This is very strange artifact. It gives 20% to growth and 10% to culture but takes 15% from production";
                case "BHS": return "This is very strange artifact. It takes 10% from growth and culture and gives 45% to science";
                case "AF": return "It gives you 15% in attack and defense but takes 30% from culture, 45% from science, 50% from production and 90% from growth";
                case "MOT": return "It gives you 20% to culture, 20% to science and 20% to growth.";
                default:
                    return string.Empty;
            }
        }
        public static string ArtifactName(string id)
        {
            switch (id)
            {//science artifacts
                case "AL": return "Astro lab";
                case "GL": return "Gravity lab";
                case "AML": return "Antimatter lab";
                //production artifacts
                case "CS": return "Cold fusion powerplants";
                case "RF": return "Robitcs factories";
                case "NF": return "Nano factories";
                //culture
                case "GT": return "Global theater";
                case "ITV": return "Interstellar TV";
                //growth
                case "E1": return "Space exploration 1";
                case "E2": return "Space exploration 2";
                case "E3": return "Space exploration 3";
                //attack
                case "PG": return "Plasma guns";
                case "GG": return "Gravity guns";
                //defense
                case "ES": return "Energy shields";
                case "PS": return "Plasma shields";

                //special artifacts
                case "STr": return "Sol trade routes";
                case "BHS": return "Black hole science";
                case "AF": return "Aurora fighters";
                case "MOT": return "Mother of trade";
                default:
                    return string.Empty;
            }
        }
        public static int Cost(string id)
        {
            switch (id)
            {//science artifacts
                case "AL": return 2000;
                case "GL": return 10000;
                case "AML": return 21000;
                //production artifacts
                case "CS": return 4000;
                case "RF": return 16000;
                case "NF": return 60000;
                //culture
                case "GT": return 2500;
                case "ITV": return 12000;
                //growth
                case "E1": return 1200;
                case "E2": return 7200;
                case "E3": return 14400;
                //attack
                case "PG": return 27000;
                case "GG": return 54000;
                //defense
                case "ES": return 24000;
                case "PS": return 48000;

                //special
                case "STr": return 30000;
                case "BHS": return 60000;
                case "AF": return 220000;
                case "MOT": return 130000;
                default:
                    return 0;
            }
        }
    }
}
